/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package fhedu;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.GameCanvas;

/**
 *
 * @author kUN
 */
public class CellMeNu extends GameCanvas{
    String anh="";
    String text="";
    int x=0,y=0;
    
    CellMeNu()
    {
        super(false);
        
    }

    public CellMeNu(String anh1,String text1) {
        super(false);
        anh=""+anh1;
        text=""+text1;
    }
    
    void Draw(Graphics g, int x1, int y1)
    {
        x=x1;y=y1;
        int tgcolor=g.getColor();
        g.setColor(0xc4e1f6);
        g.fillRect(x, y, 200, 20);
        g.setColor(tgcolor);
        try{
            Image icon= Image.createImage(anh);
            g.drawImage(icon, x+4, y+1, Graphics.TOP|Graphics.LEFT);
        }catch(Exception e){};
        
        g.drawString(text, x+40, y+2, Graphics.TOP|Graphics.LEFT);
  
        //flushGraphics();
        
        
    }
    void FoCus(Graphics g)
    {
        int rgb[] = new int[200*20];
        Image focus=Image.createImage(200,20);
        Graphics gfocus=focus.getGraphics();
        gfocus.setColor(0x329be7);
        gfocus.fillRect(0, 0, 200, 20);
        focus.getRGB(rgb, 0, 200, 0, 0, 200, 20);
        
        //Image createRGBImage = Image.createRGBImage(rgb, 200, 20, true);
        for(int i=0,n=rgb.length;i<n;i++)
        {
            rgb[i]&=0x77ffffff;
        }
        g.drawRGB(rgb, 0,200,x,y,200,20,true);
        
        g.setColor(0xff0000);
        g.drawString(text, x+40, y+2, Graphics.TOP|Graphics.LEFT);
        
        
    }
    void UnFocus(Graphics g)
    {
        g.setColor(0x000000);        
        this.Draw(g, x, y);
    }

    
}
